<template>
  <div>
    <h3>水果店</h3>
    <p>苹果10元/斤,折扣(8折)</p>
    请输入你要购买的斤数<input type="text" v-model.number="num">
    <br><br>
    <button @click="sum">结账买单</button>
    <p>结账单:总价{{total}}元 折后价{{total*0.8}}元省了:{{total*0.2}}元</p>
  </div>
</template>

<script>
export default {
data (){
  return {
    num:0,
    total:'',
  }
},
methods:{
  sum(){
    this.total=this.num*10
  }
}
}
</script>

<style>

</style>